package com.zzl.bonds.ticket.dto.finance;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.zzl.apidoc.annotation.ApidocModel;
import com.zzl.apidoc.annotation.ApidocModelProperty;
import com.zzl.apidoc.constants.RequiredType;
import com.zzl.bonds.ticket.constant.status.TicketStatusEnum;
import com.zzl.general.common.utils.DoubleSerialize;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * 融资申请单
 *
 * @author gull
 * @date 2022-02-24 13:53:42
 */
@Data
@ApidocModel
public class TicketFinanceDetailDto implements Serializable {
    private static final long serialVersionUID = 1L;

    private String id;
    /**
     * 凭证信息
     */
    @ApidocModelProperty(description = "凭证编号")
    private String ticketNo;
    @ApidocModelProperty(description = "凭证金额")
    private Double ticketAmount;

    @ApidocModelProperty(description = "开单企业")
    private String coreEnterpriseName;
    @ApidocModelProperty(description = "转单企业")
    private String transferEnterpriseName;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApidocModelProperty(description = "开单日期", validate = "yyyy-MM-dd HH:mm:ss")
    private Date openTime;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApidocModelProperty(description = "转单日期", validate = "yyyy-MM-dd HH:mm:ss")
    private Date transferTime;


    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApidocModelProperty(description = "到期日期", validate = "yyyy-MM-dd")
    private Date cashTime;

    @ApidocModelProperty(description = "票据来源")
    private String ticketTypeSource;
    @ApidocModelProperty(description = "期限")
    private String limitDays;
    @ApidocModelProperty(description = "剩余兑付天数")
    private String surplusCashingDays;

    @ApidocModelProperty(description = "凭证基本信息-金融机构", required = RequiredType.TRUE)
    private String ticketInstinctyName;
    @ApidocModelProperty(description = "凭证状态 1：融资待复核 2、融资已复核 3、平台待复核 4、平台已复核 5、待放款")
    private String ticketStatusName;
    @JsonIgnore
    private Integer ticketStatus;

    public String getTicketStatusName() {
        return TicketStatusEnum.getStatusName(ticketStatus);
    }

    /////////////////////////////////////////////业务信息
    @JsonSerialize(using = DoubleSerialize.class)
    @ApidocModelProperty(description = "融资金额")
    private Double sellAmount;
    @JsonSerialize(using = DoubleSerialize.class)
    @ApidocModelProperty(description = "转让金额")
    private Double transferAmount;

    @ApidocModelProperty(description = "业务信息-金融机构")
    private String instinctyName;
    @ApidocModelProperty(description = "金融机构id")
    private Integer instinctyId;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApidocModelProperty(description = "融资申请时间", validate = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApidocModelProperty(description = "实际放款时间", validate = "yyyy-MM-dd HH:mm:ss")
    private Date loanTime;
    @ApidocModelProperty(description = "融资利率是否年化,0：否，1:是")
    private Integer isAnnualizedInterestRate;
    @ApidocModelProperty(description = "融资利率")
    private Double annualizedInterestRate;
    @ApidocModelProperty(description = "预计融资利息")
    @JsonSerialize(using = DoubleSerialize.class)
    private Double estimatedFinancingInterest;
    @ApidocModelProperty(description = "服务费用")
    @JsonSerialize(using = DoubleSerialize.class)
    private Double serviceChage;

    @ApidocModelProperty(description = "业务状态 1：融资待复核 2、融资已复核 3、平台待复核 4、平台已复核 5、待放款")
    private String financeStatusName;
    @ApidocModelProperty(description = "融资编号")
    private String financeBillNo;
    @ApidocModelProperty(description = "所属企业id")
    private String enterpriseId;
    @ApidocModelProperty(description = "所属企业名称")
    private String enterpriseName;
    public String getFinanceStatusName() {
        return TicketStatusEnum.getStatusName(ticketStatus);
    }
}
